<%@ page pageEncoding="utf-8" isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>校园超市管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/public.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/style.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/js/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/themes/icon.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/js/bootstrap/css/bootstrap.min.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/jsp/js/jQuery1.11.1.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
    <%--  <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.pagination.js"></script>--%>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        var  loginOut;
        var xiugai;
        $(function () {
            xiugai = function passwordXiu() {
                var oldPassword = $("#oldPassword").val();
                var newPassword = $("#newPassword").val();
                var reNewPassword = $("#reNewPassword").val();
                if ((oldPassword.length >= 6) && (newPassword.length >= 6) && (reNewPassword.length >= 6)) {
                    if (oldPassword == newPassword) {
                        $.messager.alert("温馨提示", "旧密码不得于新密码重复", "error");
                    } else if (newPassword != reNewPassword) {
                        $.messager.alert("温馨提示", "两个新密码输入不一致，请重新输入", "error");
                    } else {
                        $.ajax({
                            url: "${pageContext.request.contextPath}/updatePassword",
                            type: "post",
                            data: {"oldPassword": oldPassword, "newPassword": newPassword},
                            success: function (data) {
                                if (data.data == 1) {
                                    $.messager.alert("温馨提示", "修改成功", "info");
                                    setTimeout(function () {
                                        location.href = "${pageContext.request.contextPath}/loginout";
                                    }, 2000);
                                } else if (data.data == 3) {
                                    $.messager.alert("温馨提示", "旧密码输入不正确，请重新输入", "error");
                                    return false;
                                } else {
                                    $.messager.alert("温馨提示", "修改失败", "error");
                                    return false;
                                }
                            }
                        });
                    }
                } else {
                    $.messager.alert("温馨提示", "密码不得少于六位", "error");
                }
            }

            loginOut=function userLoginOut() {
                $.messager.confirm("温馨提示", "确定要退出吗？", function (r) {
                    if (r) {
                        location.href="${pageContext.request.contextPath}/loginout";
                    } else {
                        return false;
                    }

                });
            }
        });
    </script>
</head>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>校园超市管理系统</h1>
    <div class="publicHeaderR">
        <p><span>您好！</span><span style="color: #fff21b">${keyword} ${login}</span> , 欢迎你！</p>

    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2015年1月1日 11:11  星期一</span>
    <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器！（IE10+）</a>
</section>
<!--主体内容-->
<section class="publicMian ">
    <div class="left">
        <h2 class="leftH2">
            <span class="span_gn">功能列表</span>
        </h2>
        <nav>
            <ul class="list">
                <li><a href="${pageContext.request.contextPath}/jsp/productList.jsp">商品管理</a></li>
                <li><a href="${pageContext.request.contextPath}/jsp/billList.jsp">订单管理</a></li>
                <li><a href="${pageContext.request.contextPath}/jsp/providerList.jsp">供应商管理</a></li>
                <li><a href="${pageContext.request.contextPath}/jsp/userList.jsp">用户管理</a></li>
                <li id="active"><a href="${pageContext.request.contextPath}/jsp/password.jsp">密码修改</a></li>
                <li><a onclick="loginOut()">退出系统</a></li>
            </ul>
        </nav>
    </div>
    <div class="right" id="app">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>密码修改页面</span>
        </div>
        <div class="providerAdd">
            <form action="#">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <div class="">
                    <label for="oldPassword">旧密码：</label>
                    <input type="password" name="oldPassword" id="oldPassword" required/>
                    <span>*请输入原密码</span>
                </div>
                <div>
                    <label for="newPassword">新密码：</label>
                    <input type="password" name="newPassword" id="newPassword" required/>
                    <span>*请输入新密码</span>
                </div>
                <div>
                    <label for="reNewPassword">确认新密码：</label>
                    <input type="password" name="reNewPassword" id="reNewPassword" required/>
                    <span>*请输入新确认密码，保证和新密码一致</span>
                </div>
                <div class="providerAddBtn">
                    <!--<a href="#">保存</a>-->
                    <input type="button" value="保存" onclick="xiugai()"/>
                </div>
            </form>
        </div>
    </div>
</section>


<footer class="footer">
    版权归本超市所有
</footer>
<script src="js/time.js"></script>

</body>
</html>